<?php
 session_start();
 require_once 'WebBean.interface.php';
class Cursus2 implements WebBean{
    private $listeModules;
    
    
    function _construct(){
        if(isset($_SESSION['cursus'])){
            //var_dump($_SESSION['cursus']);
            //$this->setList($_SESSION['cursus']);
        
            foreach ($_SESSION['cursus'] as $key => $value){
                $this->listeModules[$key]=$value;
            }
            print_r($this->listeModules);
           
        }
        else{
            $this->listeModules=array();
            echo"oo";
        }
           
        
    } 
    function valide() {

    }
    function pageKO(){
         
    }
    function pageOK() {
            echo Charte::html_head_bootstrap("Cursus main");
           
     }
        
     public function sauveTXT(){
    
     }
       
    public function sauveXML($file){
            
    }
       
    public function sauveBDR($table){
   
    }
      
    public function createTable($table){
    
        
    }
    public function page_foot(){
            echo Charte::html_foot_bootstrap();
    }
    function setList($array){
        $this->listeModules=$array;
    }
    function addModule($module){
        //$_SESSION['cursus'][$module->getSigle()]=$module;
        //$_SESSION[$module->getSigle()]=$module;
        $this->listeModules[$module->getSigle()]=$module;
        $_SESSION['cursus'][$module->getSigle()]=$this->listeModules[$module->getSigle()];
       // var_dump($_SESSION['cursus']);
        //var_dump($this->listeModules);
        
    }
    function __toString(){
          return "Cursus->($this->listeModules)";
    } 
    function affiche(){
        
        var_dump( $_SESSION['cursus']);
       
    }
}

